package com.some;

import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class ByteDance5_6_2 {
    public boolean validSet(int T, String[] strs, int[] intLen){
        List<String> list = Arrays.asList(strs);
        list.sort(String::compareTo);
        for (String str : strs) {
            for (int i : intLen) {
                if (str.length()>i && list.contains(str.substring(0,i))){
                    return true;
                }
            }
        }
        return false;
    }
}
class Main5_6_2{
    public static void main(String[] args) {
        ByteDance5_6_2 byteDance5_6_2 = new ByteDance5_6_2();
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean[] result = new boolean[N];
        for (int i = 0; i < N; i++) {
            int T = sc.nextInt();
            String[] strs = new String[T];
            int[] intLen = new int[T];
            for (int j = 0; j < T; j++) {
                strs[j] = sc.next();
                intLen[j] = strs[j].length();
            }
            result[i]  = byteDance5_6_2.validSet(T, strs, intLen);
        }
        for (boolean b : result) {
            if (b){
                System.out.println("YES");
            }else {
                System.out.println("NO");
            }
        }
    }
}